@import "../vars";

$xdhCalendar: '.xdh-calendar';

.xdh-calendar {
  * {
    box-sizing: border-box;
  }

  &__header {
    padding: 11px 16px 11px 0;
    text-align: right;
  }

  &__select {
    /deep/ .el-input__inner {
      padding-left: 10px;
    }
    /deep/ .el-radio-button--mini .el-radio-button__inner {
      padding-left: 10px;
      padding-right: 10px;
    }
    &--year, &--month, &--radio {
      display: inline-block;
    }
    &--year {
      .el-select {
        width: 80px;
      }
    }
    &--month {
      margin-left: 5px;
      .el-select {
        width: 70px;
      }
    }
    &--radio {
      margin-left: 16px;
    }
  }

  &__body {
    height: calc(100% - 54px);
    padding: 8px 12px;
    border-top: 1px solid $--widgets-calendar-border-color;
    &--inner {
      height: 100%;
    }
  }

  &__range {
    display: flex;
    flex-wrap: wrap;
    align-content: flex-start;
    &--month {
      height: 100%;
    }
    &--week {
      height: 24px;
    }
    &--day {
      height: calc(100% - 24px);
    }
    &--block {
      cursor: pointer;

      @at-root #{$xdhCalendar}__range--month & {
        width: calc(100% / 3);
        height: calc(100% / 4);
        padding: 0 4px;
        display: flex;
        justify-content: center;
        align-items: center;
      }
      @at-root #{$xdhCalendar}__range--week & {
        width: calc(100% / 7);
        text-align: center;
        cursor: default;
      }
      @at-root #{$xdhCalendar}__range--day & {
        width: calc(100% / 7);
        height: calc(100% / 6);
        padding: 0 4px;
      }
    }

    &--gray {
      color: $--widgets-calendar-disabled-color;
    }
  }

  &__text {
    text-align: center;
    &--value {
      margin: 0 auto;
      border-radius: 2px;
      width: 24px;
      height: 24px;
      line-height: 24px;

      &:hover {
        background: $--widgets-calendar-hover-background-color;
      }
      @at-root #{$xdhCalendar}__range--month & {
        width: 48px;
      }
      @at-root #{$xdhCalendar}__range--today & {
        box-shadow: inset 0 0 0 1px $--color-primary;
      }
      @at-root #{$xdhCalendar}__range--active & {
        background: $--widgets-calendar-active-background-color;
      }
    }
    &--content {
      height: calc(100% - 24px);
      text-align: right;
      overflow-y: auto;
    }
  }

  &--full {
    width: 100%;
    height: 100%;
    #{$xdhCalendar}__select {
      &--year {
        .el-select {
          width: 100px;
        }
      }
      &--month {
        .el-select {
          width: 80px;
        }
      }
    }

    #{$xdhCalendar}__body {
      border-top: 0;
    }

    #{$xdhCalendar}__text {
      width: 100%;
      height: 100%;
      padding: 4px 8px;
      border-top: 2px solid $--widgets-calendar-border-color;
      &:hover {
        background: $--widgets-calendar-hover-background-color;
      }
      &--value {
        width: auto;
        text-align: right;
        background: transparent;
      }
    }

    #{$xdhCalendar}__range--today {
      #{$xdhCalendar}__text {
        border-top-color: $--color-primary;
        &--value {
          box-shadow: none;
        }
      }
    }

    #{$xdhCalendar}__range--active {
      #{$xdhCalendar}__text {
        background: $--widgets-calendar-active-background-color;
        &--value {
          color: $--color-primary;
        }
      }
    }

    #{$xdhCalendar}__range--day, #{$xdhCalendar}__range--month {
      #{$xdhCalendar}__range--block {
        height: 116px;
      }
    }

    #{$xdhCalendar}__range--week {
      #{$xdhCalendar}__range--block {
        padding-right: 10px;
        padding-bottom: 5px;
        text-align: right;
      }
    }
  }
}
